using UnityEditor;
using UnityEngine;

namespace UnityXEditor
{
    public static class InspectorTool
    {
        /// <summary>
        /// 组件置顶
        /// </summary>
        /// <param name="component">组件对象</param>
        public static void SetAsFirstComponent(Component component)
        {
            Object[] objects = new Object[] { component };
            for (int i = 0; i < 10; i++)
            {
                EditorMenuTool.ExecuteMenuItem("CONTEXT/Component/Move Up", objects);
            }
        }
        /// <summary>
        /// 绘制带类型的属性
        /// </summary>
        /// <param name="name"></param>
        /// <param name="serializedProperty1"></param>
        /// <param name="serializedProperty2"></param>
        public static void DrawTypeProperty(string name, SerializedProperty serializedProperty1, SerializedProperty serializedProperty2)
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PropertyField(serializedProperty1, new GUIContent(name), GUILayout.MaxWidth(10000));
            EditorGUILayout.PropertyField(serializedProperty2, GUIContent.none, GUILayout.MaxWidth(10000));
            EditorGUILayout.EndHorizontal();
        }
    }
}
